package com.xmall.controller.admin;

import com.xmall.bean.vo.BaseRespVo;
import com.xmall.bean.vo.RowsGoodsVO;
import com.xmall.bean.vo.RowsOrderVO;
import com.xmall.bean.vo.RowsUserVO;
import com.xmall.bean.vo.StatisticalReportVO;
import com.xmall.service.StatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Connor
 * @ClassName: StatMapper
 * @PackageName: com.xmall.controller
 * @date 2020/12/06
 * @Version 1.0
 */
@RestController
@RequestMapping("admin/stat")
public class StatController {

    @Autowired
    StatService statService;

    @GetMapping("user")
    public BaseRespVo getUserStatisticalReport() {
        // TODO 获取用户统计报表
        StatisticalReportVO<RowsUserVO> statisticalReportVO = statService.queryUserData();
        return BaseRespVo.ok(statisticalReportVO);
    }

    @GetMapping("order")
    public BaseRespVo getOrderStatisticalReport() {
        // TODO 获取订单统计报表
        StatisticalReportVO<RowsOrderVO> statisticalReportVO = statService.queryOrderData();
        return BaseRespVo.ok(statisticalReportVO);
    }

    @GetMapping("goods")
    public BaseRespVo getGoodsStatisticalReport() {
        // TODO 获取商品统计报表
        StatisticalReportVO<RowsGoodsVO> statisticalReportVO = statService.queryGoodsData();
        return BaseRespVo.ok(statisticalReportVO);
    }
}
